package dunshan.textdemo

import io.gatling.core.Predef._
import io.gatling.http.Predef._

class FormSimulation extends Simulation {

  val httpConf = http.baseUrl("http://127.0.0.1:8080")
  //注意这里,设置提交内容type
  val contentType = Map("Content-Type" -> "application/x-www-form-urlencoded")
  //声明scenario
  val scn = scenario("formScenario")
    .exec(http("form_test") //http 请求name
      .post("/login") //post地址, 真正发起的地址会拼上上面的baseUrl http://127.0.0.1:8080/login
      .headers(contentType)
      .formParam("userName", "7d") //form 表单的
      .formParam("passWord", "123456"))
//      setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))

    setUp(scn.inject(constantUsersPerSec(2)during(10))).protocols(httpConf)


}
